<template>
	<uni-popup ref="popup" type="bottom">
		<view class="mainBody">
			<view class="popup-header">
				<view @click="close">取消</view>
				<view class="right" @click="confirmPicker">确定</view>
			</view>
			<view class="popup-content">
					<picker-view indicator-style="height: 50px" class="picker-view" :value="pickerIndex" @change="changePicker">
						<picker-view-column>
							<view class="picker-item" :style="{fontSize:itemFontSize}" v-for="(item, i) in approverList"
								:key="i">
								{{item.name}}({{item.postName}})
							</view>
						</picker-view-column>
					</picker-view>
			</view>
		</view>
	</uni-popup>
</template>

<script>
	import {
		submitReimburse
	} from "@/api/reimburseApply.js"
	export default {
		props:{
			//页面传过来的数据
			approverList: {
				type: Array,
				default: () => {
					return [];
				}
			},
			travelApplicationId:''
		},
		data(){
			return{
				pickerIndex:0,
			}
		},
		onLoad(option) {
			
		},
		watch(){},
		methods:{
			open(){
				this.$refs.popup.open()
			},
			close() {
				this.$refs.popup.close()
			},
			//确定
			async confirmPicker() {
				// 提交报销申请单
				let res = await submitReimburse({
					travelApplicationId: this.travelApplicationId,
					actorId: this.actorId,
					levelId: this.levelId,
					id: uni.getStorageSync('bankId')
				})
				this.showPicker = false;
				uni.navigateBack({
					delta: 3
				})
			},
			changePicker(e){
				var thisIndex = e.detail.value;
				this.actorId = this.approverList[thisIndex].userId
				this.levelId = this.approverList[thisIndex].job
			}
		}
	}
</script>

<style scoped lang="scss">
	@function vww($number) {
		@return ($number / 375) * 750+rpx;
	}
	.mainBody{
		width: 100vw;
		height: 50vh;
		background: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 99999;
	}
	.one{height: 80rpx;border: 1rpx solid #007AFF;}
	
	.popup-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 32rpx;
		font-weight: 400;
		background-color: #F7F6F8;
		height: 48rpx;
		line-height: 45rpx;
		padding: 36rpx 30rpx 26rpx;
		position: relative;
		.right{
			color: #FFA900;
		}
	}
	
	.popup-content {
		position: relative;
		background-color: #fff;
		margin: 49rpx 0;
	}
	
	
	
</style>